//----------------------------------------------------------
// HUDManager.cpp
//   Class to interface between the Engine and HUD_Game
// 
//----------------------------------------------------------

#include <d3d9.h>

#include "HUD_Game.h"
#include "HUDManager.h"

HUDManager::HUDManager()
{
	// do nothing
}
HUDManager::~HUDManager() 
{ 
	delete _HUD; 
}

bool HUDManager::Initialize(LPDIRECT3DDEVICE9 pD3DDevice, Engine *pEngine, gamemode_t eMode)
{
	_HUD = new HUD_Game();
	return (_HUD->Initialize(pD3DDevice, pEngine, eMode)) && (BuildHUD());
}

bool HUDManager::BuildHUD()
{
	// turns on elements of the HUD depending
	//   on the game mode
	switch (_HUD->GetGameMode()) 
	{
		case GAME_STRING:
		case GAME_LASER:
		case GAME_FINGER:

			// create, set and start the HUD countdown timer
			_HUD->ShowTimer(true);
			_HUD->Countdown()->Initialize(90000.0f, YAC_TIMER_DESCEND);
			_HUD->Countdown()->Start();  // this needs to be abstracted higher
										 //  the HUD builder shouldn't start the mode
										 //  leaving for test purposes for now
			break;

		default:

			_HUD->ShowTimer(false);
			break;
	}

	return true;
}

bool HUDManager::Draw()
{
	_HUD->DisplayText();		// draws any font elements
	_HUD->DisplayTextures();	// draws any 2D texture elements
	return true;
}

bool HUDManager::Shutdown()
{
	// do nothing for now
	return true;
}